<template>
	<view class="section stores">
		<view class="section-title">
			<text class="title-text">连锁门店</text>
			<text class="more" @click="navigateToMore">更多 ></text>
		</view>
		<scroll-view scroll-x class="store-scroll">
			<view class="store-card" v-for="(item, index) in stores" :key="index" @click="navigateToStore(item.id)">
				<image :src="item.logo" mode="aspectFill" class="store-img"></image>
				<view class="store-info">
					<text class="store-name">{{item.name}}</text>
					<text class="store-address">{{item.address}}</text>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script setup>
import {useData} from "../../../common/useData";

const {modelData:stores}=useData("/store/list",{size:21})

const navigateToMore = () => {
	uni.navigateTo({
		url: `/pages/product-list/product-list?type=stores`
	})
}

const navigateToStore = (id) => {
	uni.navigateTo({
		url: `/pages/store/detail?id=${id}`
	})
}
</script>

<style>
.section {
	background-color: #FFFFFF;
	padding: 20rpx;
	margin-bottom: 20rpx;
}

.section-title {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 20rpx;
}

.title-text {
	font-size: 32rpx;
	font-weight: bold;
	color: #333;
	padding-left: 20rpx;
	border-left: 8rpx solid #D02B29;
}

.more {
	font-size: 24rpx;
	color: #999;
}

.store-scroll {
	white-space: nowrap;
}

.store-card {
	display: inline-block;
	width: 300rpx;
	margin-right: 20rpx;
	background-color: #F5F5F5;
	border-radius: 10rpx;
	overflow: hidden;
}

.store-img {
	width: 300rpx;
	height: 200rpx;
}

.store-info {
	padding: 10rpx;
}

.store-name {
	font-size: 28rpx;
	color: #333;
	font-weight: bold;
	display: block;
	margin-bottom: 6rpx;
}

.store-address {
	font-size: 24rpx;
	color: #666;
	display: block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
</style> 